<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/9/13
  Time: 10:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="../common/include.jsp" %>
<html>
<head>
    <title>Title</title>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content  animated fadeInRight">
    <form class="form-horizontal" id="demandForm" name="demandForm">
        <input type="hidden" id="demId" name="demId" value="${tDemandSource.id}">
        <input type="hidden" id="status" name="status" value="${tDemandSource.status}">
        <input type="hidden" id="isReceive" name="isReceive" value="${isReceive}">
        <div class="tabs-container">
            <fieldset>

                <c:if test="${tDemandSource.status == 1 && isReceive == 1}">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">产品经理*：</label>
                        <div class="col-sm-4">
                            <select class="form-control" name="currentPrincipal"
                                    id="currentPrincipal">
                                <c:forEach items="${users}" var="det">
                                    <option value="${det.id}">${det.realName}</option>
                                </c:forEach>
                            </select>
                        </div>
                    </div>
                </c:if>

                <div class="form-group">
                    <label class="col-sm-2 control-label">处理意见：</label>
                    <div class="col-sm-7">
                                    <textarea id="remark" name="remark"
                                              class="form-control"
                                              rows="5"></textarea>
                    </div>
                </div>

            </fieldset>
            <fieldset>
                <div class="form-group">
                    <div class="col-sm-7" style="text-align: center;">

                        <input value="提交" class="btn  btn-primary" type="button" id="submitBtn">
                        <button id="closeBut" onclick="closeWin()" class="btn  btn--white" type="button">关闭</button>
                    </div>
                </div>
            </fieldset>
        </div>
    </form>
</div>

<script>
    function closeWin() {
        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
        parent.layer.close(index); //再执行关闭
    }


    $("#submitBtn").click(function () {
        var remark = $("#remark").val();
        var isReceive = $("#isReceive").val();
        var demandId = $("#demId").val();
        var status = $("#status").val();
        var currentPrincipal = $("#currentPrincipal").find("option:selected").text();
        var currentPrincipalId = $("#currentPrincipal").val();


        //父窗口信息
        var title =  parent.$("#title").find("option:selected").text();

        var detail = parent.$("#detail").val();

        var feedback_name = parent.$("#feedback_name").val();
        var demand_product = parent.$("#demand_product").val();
        var demand_type = parent.$("#demand_type").val();
        //var demand_type = $("#demand_type").find("option:selected").text();
        //var brandRecommend = $('input[name="brandRecommend"]:checked ').val();
        var feedback_city = parent.$("#feedback_city").find("option:selected").text();
        var feedback_time = parent.$("#feedback_time").val();
        //var feedback_source = $("#feedback_source").val();
        var feedback_source = parent.$("#feedback_source").find("option:selected").text();
        var department = parent.$("#department").find("option:selected").text();
        var departmentId = parent.$("#department").val();
        var priority = parent.$("#priority").val();
        var principal = parent.$("#principal").find("option:selected").text();
        var principalId = parent.$("#principal").val();
        var createTime = parent.$("#create_time").val();
        var id = parent.$("#demId").val();


        var args = {
            "status": status,
            "demandId": demandId,
            "isReceive": isReceive,
            "remark": remark,
            "currentPrincipal": currentPrincipal,
            "currentPrincipalId": currentPrincipalId,
            "feedbackSource": feedback_source,
            "id": id,
            "feedbackName": feedback_name,
            "feedbackCity": feedback_city,
            "demandProduct": demand_product,
            "feedbackTime": feedback_time,
            "createTime": createTime,
            "detail": detail,
            "title": title
        }

        var url = "updAndCheck.html";

        //加载进度条
        layer.load(2, {
            shade: [0.2, '#999999'] //0.1透明度的白色背景
        });
        $.post(url, args, function (data) {
            data = jQuery.parseJSON(data);
            //保存成功
            if (data.code == 1) {
                layer.closeAll('loading');
                layer.alert(data.msg,
                    function () {
                        parent.layer.closeAll(); //关闭所有的iframe层
            });


            } else {
                //失败
                layer.alert("失败");
                layer.closeAll('loading');
            }
        });

    });

</script>
</body>
</html>
